﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>ASP.NET Boilerplate</title>
<link type="text/css" rel="stylesheet" href="bootstrap.min.css" />
</head>

<body>

<div class="document-contents">

	<p><a href="http://hangfire.io/" target="_blank">Hangfire</a> is a 
	compherensive background job manager. You can <strong>integrate</strong> ASP.NET Boilerplate 
	with Hangfire to use it instead of 
	<a href="/Pages/Documents/Background-Jobs-And-Workers">default background job manager</a>. You can 
	use the <strong>same background job API</strong> for Hangfire. Thus, your code will be 
	<strong>independent</strong> of Hangfire. But, if you like, you can directly use 
	<strong>Hangfire's 
	API</strong> also.</p>
	<p>First, install
	<a href="https://www.nuget.org/packages/Abp.HangFire" target="_blank">
	<strong>Abp.HangFire</strong></a> nuget package to your project. Then you can install any 
	storage for Hangfire. Most common one is SQL Server storage (see <a href="https://www.nuget.org/packages/Hangfire.SqlServer" target="_blank">
	<strong>Hangfire.SqlServer</strong></a> 
	nuget package). After you installed these nuget packages, you can 
	<strong>configure</strong> ASP.NET Boilerplate to use Hangfire as shown below:</p>
	<pre lang="cs"><strong>[DependsOn(typeof (AbpHangfireModule))]</strong>
public class MyProjectWebModule : AbpModule
{
    public override void PreInitialize()
    {
<strong>        Configuration.BackgroundJobs.UseHangfire(configuration =&gt;
        {
            configuration.GlobalConfiguration.UseSqlServerStorage(&quot;Default&quot;);
        });
</strong>    }

    //...
}</pre>
	<p>We added <strong>AbpHangfireModule</strong> as a dependency and used 
	Configuration.BackgroundJobs.<strong>UseHangfire</strong> method to enable 
	and configure Hangfire ("Default" is the connection string in web.config).</p>
	<p>See <a href="http://docs.hangfire.io/en/latest/" target="_blank">Hangfire 
	documentation</a> for more information.</p>
	<p>&nbsp;</p>

</div>

</body>

</html>
